﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using System.Diagnostics;

namespace Utils.ContentManagement
{
    public class ContentLoader
    {
        ContentManager contentManager;

        static IServiceProvider service;

        public static void Init(IServiceProvider service)
        {
            ContentLoader.service = service;
        }

        public ContentLoader(string root)
        {
            Debug.Assert(service != null, "call ContentLoader.Init() before creating new instances");
            contentManager = new ContentManager(service, root);
        }

        public T Load<T>(string assetName)
        {
            return contentManager.Load<T>(assetName);
        }

        public void Unload()
        {
            contentManager.Unload();
        }
    }
}
